package my.study.designpattern.simplefactory;

public class FruitFactory {
	public static Fruit createFruit(String name) throws BadFruitNameException {
		if (name == "Apple") {
			return new Apple();
		} else if (name == "Grape") {
			return new Grape();
		} else
			throw new BadFruitNameException("BadName");
	}
}
